package org.jwcloud.project.module.zx.timingAnalyse.controller;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.jwcloud.project.module.zx.common.Resp;
import org.jwcloud.project.module.zx.common.repository.RptCommonRepository;
import org.jwcloud.project.module.zx.template.service.RptTemplateService;
import org.jwcloud.project.module.zx.timingAnalyse.service.DoingAnalyseService;
import org.jwcloud.project.module.zx.timingAnalyse.service.TimingAnalyseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.jw.mid.mm.comm.common.controller.BaseController;
import com.jw.mid.mm.comm.common.controller.CrudController;
import com.jw.mid.mm.comm.common.json.Response;
import com.jw.mid.mm.comm.common.pagination.ListBounds;
import com.jw.mid.mm.comm.common.pagination.ListSlice;
import com.jw.mid.mm.comm.common.pagination.Pagination;
import com.jw.mid.mm.comm.common.service.CrudService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@Api(value = "API - Controlle",
description = "在建项目统计", tags = "doingAnalyse")
@RestController
@RequestMapping("/rest/doingAnalyse")
public class DoingAnalyseController extends BaseController{
	
//	@Autowired
//    private CommonService commonService;
	
	@Autowired
	public RptCommonRepository rptCommonRepository;
	
	@Autowired
    private DoingAnalyseService doingAnalyseService;
	
    //------------
    @GetMapping("queryTitleData")
    @ApiOperation(value = "项目总数、预警总数、一次预警总数、二次预警总数", notes = "")
    @ApiImplicitParams({
//    	@ApiImplicitParam(name = "template_id", value = "模板id", required = true, dataType = "string", paramType = "query"),
    })
    public Resp<Object> queryTitleData(
    		@RequestParam(required = false) Map<String,String> param
    		){
        return doingAnalyseService.queryTitleData(param);
    }
    
    @GetMapping("queryStepBar")
    @ApiOperation(value = "阶段统计", notes = "")
    @ApiImplicitParams({
    })
    public Resp<Object> queryStepBar(
    		@RequestParam(required = false) Map<String,String> param
    		){
        return doingAnalyseService.queryStepBar(param);
    }
    
    @GetMapping("queryProTypePie")
    @ApiOperation(value = "项目类型统计", notes = "")
    @ApiImplicitParams({
    })
    public Resp<Object> queryProTypePie(
    		@RequestParam(required = false) Map<String,String> param
    		){
        return doingAnalyseService.queryProTypePie(param);
    }
    
    @GetMapping("queryDurSumLine")
    @ApiOperation(value = "项目持续时间统计", notes = "")
    @ApiImplicitParams({
    })
    public Resp<Object> queryDurSumLine(
    		@RequestParam(required = false) Map<String,String> param
    		){
        return doingAnalyseService.queryDurSumLine(param);
    }
    
    @GetMapping("queryWarnTop")
    @ApiOperation(value = "项目超时预警数量排名top10", notes = "")
    @ApiImplicitParams({
    })
    public Resp<Object> queryWarnTop(
    		@RequestParam(required = false) Map<String,String> param
    		){
        return doingAnalyseService.queryWarnTop(param);
    }
    
    @GetMapping("queryDeptPie")
    @ApiOperation(value = "部门预警数量饼", notes = "")
    @ApiImplicitParams({
    })
    public Resp<Object> queryDeptPie(
    		@RequestParam(required = false) Map<String,String> param
    		){
        return doingAnalyseService.queryDeptPie(param);
    }
    
    //--------------------
    
    @GetMapping("queryTitleData_gd")
    @ApiOperation(value = "标题", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "start_time", value = "开始时间 2020-09-01", required = false, dataType = "string", paramType = "query"),
    	@ApiImplicitParam(name = "end_time", value = "结束时间", required = false, dataType = "string", paramType = "query"),
    })
    public Resp<Object> queryTitleData_gd(
    		@RequestParam(required = false) Map<String,String> param
    		){
        return doingAnalyseService.queryTitleData_gd(param);
    }
    @GetMapping("queryProTypePie_gd")
    @ApiOperation(value = "项目类型统计", notes = "")
    @ApiImplicitParams({
    })
    public Resp<Object> queryProTypePie_gd(
    		@RequestParam(required = false) Map<String,String> param
    		){
        return doingAnalyseService.queryProTypePie_gd(param);
    }
    @GetMapping("queryYzdwTop_gd")
    @ApiOperation(value = "业主单位top10", notes = "")
    @ApiImplicitParams({
    })
    public Resp<Object> queryYzdwTop_gd(
    		@RequestParam(required = false) Map<String,String> param
    		){
        return doingAnalyseService.queryYzdwTop_gd(param);
    }
    @GetMapping("queryFiveYear_gd")
    @ApiOperation(value = "近五年项目完成数量", notes = "")
    @ApiImplicitParams({
    })
    public Resp<Object> queryFiveYear_gd(
    		@RequestParam(required = false) Map<String,String> param
    		){
        return doingAnalyseService.queryFiveYear_gd(param);
    }
    @GetMapping("queryWarnTop_gd")
    @ApiOperation(value = "项目超时预警数量排名top10", notes = "")
    @ApiImplicitParams({
    })
    public Resp<Object> queryWarnTop_gd(
    		@RequestParam(required = false) Map<String,String> param
    		){
        return doingAnalyseService.queryWarnTop_gd(param);
    }
    @GetMapping("queryDeptPie_gd")
    @ApiOperation(value = "各部门预警次数", notes = "")
    @ApiImplicitParams({
    })
    public Resp<Object> queryDeptPie_gd(
    		@RequestParam(required = false) Map<String,String> param
    		){
        return doingAnalyseService.queryDeptPie_gd(param);
    }
    
    
}